// 库
import { renderRoutes } from 'react-router-config'
import React, { lazy } from 'react';

// 组件

const Home = lazy(() => import('@home'))
const GoodsDetail = lazy(() => import('@home/children/GoodsDetail'))
const GoodsDetailShare = lazy(() => import('@home/children/GoodsDetailShare'))
const Serach = lazy(() => import('@home/children/search'))
const Notice = lazy(() => import('@page/home/component/notice'))



const NoMatch = lazy(() => import('components/nomatch'))
const Test = lazy(() => import('components/nomatch/test'))

const Submit = lazy(() => import('@submit'))
const PayWay = lazy(() => import('@submit/children/payway'))
const PaySuccess = lazy(() => import('@submit/children/paysuccess'))
const PayFail = lazy(() => import('@submit/children/payfail'))
const Pay = lazy(() => import('@submit/children/pay'))
const HandelPay = lazy(() => import('@submit/children/handelPay'))

const Order = lazy(() => import('@order'))
const OrderDetail = lazy(() => import('@order/childCom/orderDetail'))
const PurchaseOrder = lazy(() => import('../page/PurchaseOrder'))
const PurchaseOrderDetail = lazy(() => import('../page/PurchaseOrder/OrderDetail'))
const Refund = lazy(() => import('@page/refund'))

const Profile = lazy(() => import('@profile'))
const MyAddress = lazy(() => import('@profile/tool/myaddress'))
const MyBill = lazy(() => import('@profile/tool/mybill'))
const Favorites = lazy(() => import('@profile/children/favorites'))
const EditAddress = lazy(() => import('@profile/tool/myaddress/EditAddress'))
const Location = lazy(() => import('@profile/tool/myaddress/location.jsx'))
// import Location from '@profile/tool/myaddress/location'
const Authentication = lazy(() => import('@page/Authentication'))
const Into = lazy(() => import('@page/Authentication/children/Into'))

const Category = lazy(() => import('@page/category'))
const CategoryGoods = lazy(() => import('@page/category/children/goodslist'))

const PingTuanList = lazy(() => import('@page/pingtuan'))
const Group = lazy(() => import('@page/pingtuan/children/group/index.jsx'))
const GroupShare = lazy(() => import('@page/pingtuan/children/share'))






const routes = [

  {
    path: "/",
    exact: true,
    component: Home,
    isNav: true,
    title: "火蝶甄品",
    when: true
  },
  {
    path: '/search',
    component: Serach,
    title: "搜索"
  },
  {
    path: '/goodsdetail/:id',
    component: GoodsDetail,
    title: "商品详情"
  },
  {
    path: '/goodsdetailshare/:id',
    component: GoodsDetailShare,
    title: "商品详情分享"
  },

  {
    path: '/pingtuanlist/:gid',
    component: PingTuanList,
    title: "拼单列表"
  },
  {
    path: '/group/:tuanid',
    component: Group,
    title: "火蝶甄品"
  },
  {
    path: '/sharegroup/:tuanid',
    component: GroupShare,
    title: "分享海报"
  },
  {
    path: "/category",
    exact: true,
    component: Category,
    title: "分类",
  },
  {
    path: "/category/goodslist/:code",
    exact: true,
    component: CategoryGoods,
    title: "分类商品",
  },
  {
    path: "/order/:id",
    component: Order,
    isNav: true,
    title: "我的订单",
  },
  {
    path: "/PurchaseOrder",
    component: PurchaseOrder,
    title: "采购需求",
  },
  {
    path: "/PurchaseOrderDetail/:caigouOrderId",
    component: PurchaseOrderDetail,
    isNav: true,
    title: "采购需求详情",
  },
  {
    path: "/orderdetail/:orderno",
    component: OrderDetail,
    title: "订单详情",
  },
  {
    path: "/profile",
    component: Profile,
    isNav: true,
    title: "个人中心"
  },
  {
    path: "/myfavorites",
    component: Favorites,
    title: "我的收藏"
  },
  {
    path: "/myaddress/:entryway",
    component: MyAddress,
    title: "我的地址"
  },
  {
    path: "/editaddress/:id",
    component: EditAddress,
    title: "编辑地址"
  },
  {
    path: "/location/:id",
    component: Location,
    title: "选择地址"
  },
  {
    path: "/mybill",
    component: MyBill,
    title: "我的账单"
  },

  {
    path: "/submit/:caigouOrderId/:tuanid",
    component: Submit,
    title: "支付保证金"
  },
  {
    path: "/pay/:orderno",
    component: Pay,
    title: "支付尾款"
  },
  {
    path: "/payway/:caigouno",
    component: PayWay,
    title: "支付方式"
  },
  {
    path: "/handelpay/:caigouOrderId/:tuanid",
    component: HandelPay,
    title: "支付处理中...."
  },
  {
    path: '/paysuccess/:caigouOrderId/:price',
    component: PaySuccess,
    title: '支付成功'
  },
  {
    path: '/payfail',
    component: PayFail,
    title: '支付失败'
  },
  {
    path: '/refund/:orderno',
    component: Refund,
    title: '申请退款'
  },
  {
    path: '/notices/:id',
    component: Notice,
    title: '通告'
  },
  {
    path: '/authentication',
    component: Authentication,
    title: '身份认证'
  },
  {
    path: '/into',
    component: Into,
    title: 'into'
  },
  {
    path: '/test',
    component: Test,
    title: '测试页面'
  },

  {
    component: NoMatch,
    exact: true
  },

]

const AppRouter = () => (
  renderRoutes(routes)
)

export default AppRouter

export {
  AppRouter
};






